<?php
namespace Home\Model;
use Think\Model;
class CateModel extends Model {
    /**
     * 所有分类查询
     * @return Ambigous <\Think\mixed, boolean, string, NULL, mixed, multitype:, unknown, object>
     */
    public function  getCateList(){
        $CateModel = D('cate');
        $CateList = $CateModel->order('id desc')->select();
        return $CateList;
    }
    
	/**
	 * 单个查询分类
	 * @param   $where
	 * @return  
	 */
	public function getCate($where) {
		$CateModel = D('cate');
        $Cate = $CateModel->where($where)->find();
        return $Cate;
	}
	
	/**
	 * 添加分类
	 * @param   $data
	 * @return 
	 */
	public function addCate($data) {
		$CateModel = D('cate');
		$result = $CateModel->add($data);
		return $result;
	}
	/**
	 * 修改分类
	 */
	public function upCate($where,$data){
	    $CateModel = D('cate');
	    $result = $CateModel->where($where)->save($data);
	    return $result;
	}
	/**
	 * 删除分类
	 * @param unknown $where
	 * @return Ambigous <\Think\mixed, boolean, unknown>
	 */
	public function delCate($where){
	    $CateModel = D('cate');
	    $result = $CateModel->where($where)->delete();
	    return $result;
	}
	
    
	
}